<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
?>
  <div class="container">
    <div class="row">
       <?php echo $this->render('_leftnav'); ?>
        <div class="col-md-10">
          <div class="page-header clearfix">
            <h1 class="pull-left">软件上传</h1>
            <div class="pull-right">
				<a class="btn btn-success btn-sm" href="<?=Url::toRoute(['download/index']);?>">软件列表</a>
				 <!-- <?php if(Yii::$app->session->hasFlash('success')): ?>	
				 						<?= Yii::$app->session->getFlash('success') ?>						
				 <?php endif; ?> -->
            </div>
          </div>

  <fieldset>
	<?php
	$form = ActiveForm::begin([
	'action' => ['download/uploadsoft'],
	'method'=>'post',
	'options' => [
					'enctype' => 'multipart/form-data',
					'class'=>'form-horizontal'
				 ],
	'fieldConfig' => [
                       'template' => '<div class="form-group"><div class="col-md-2 control-label">{label}</div><div class="col-md-8 controls">{input}{error} </div></div>'
					 ], 
		]);	
	?>

	<?php echo $form->field($model, 'soft_name', ['inputOptions' => ['class' => 'form-control', 'placeholder' => '请入软件名']])->textInput(['maxlength' => 20]) ?>

	<?php echo $form->field($model, 'softcate_id',['template'=>'<div class="form-group">
    <div class="col-md-2 control-label">{label}</div><div class="col-md-8 controls">  {input}{error}</div></div>'])->dropDownList($softcat, ['prompt'=>' -- 请选择 -- ']) ?>	
    
	 <div class="form-group"  style='margin-right:40px'>
      <div class="col-md-2 control-label">
        <label for="name">相关课程</label>
      </div>
       <div class="controls col-md-8 checkbox">
	<?= Html::checkboxList('course_id',[0], ArrayHelper::map($course, 'id', 'name')) ?>
	 </div>
    </div>   

	<?php echo $form->field($model, 'soft_sort', ['inputOptions' => ['class' => 'form-control', 'value' => '50']])->textInput() ?>

	<?php echo $form->field($model, 'soft_points', ['inputOptions' => ['class' => 'form-control', 'placeholder' => '15 积分']])->textInput() ?>	

	<?php echo $form->field($model, 'soft_desc', ['inputOptions' => ['class' => 'form-control', 'placeholder' => '软件的简但描述']])->textarea(['rows'=>5]) ?>

	
	<?php echo $form->field($model, 'soft_status',['template'=>'<div class="form-group">
    <div class="col-md-2 control-label">{label}</div><div class="controls col-md-8 radios">  {input}{error}</div></div>'])->radioList(['1'=>'允许','0'=>'不允许']) ?>	
    
   <?= Html::hiddenInput('image_name','', ['id'=>'image_name']) ?>
   <?= Html::hiddenInput('file_name','', ['id'=>'file_name']) ?>
   <?= Html::hiddenInput('file_size','', ['id'=>'file_size']) ?>
     <div class="form-group">
      <div class="row form-group">
		 <div class="controls col-md-offset-2 col-md-8">     
	  <?= Html::submitButton('提交', ['class'=>'sub','id'=>'sub']) ?>
		 </div>
      </div>    
	</div>	
<?php ActiveForm::end(); ?>	
	
	
	<?= Html::cssFile('./assets/css/uploadsoft.css')?>
	<?= Html::jsFile('./assets/uploadsoft/jquery.min.js')?>
	<?= Html::jsFile('./assets/uploadsoft/jquery.form.js')?>
	<?= Html::jsFile('./assets/js/uploadsoft.js')?>
	 <div class="form-group" style="margin-left:20px" >
      <div class="col-md-2 control-label">
      <label for="name">添加软件封面</label>
      </div>
       
	   <div class="btn" style="margin-left:-20px">
            <span>添加软件封面</span>
             <?= Html::fileInput('filedata','', ['id'=>'fileupload']) ?>
        </div>
        <div class="progress" style='margin-left:280px'>
    		<span class="bar"></span><span class="percent">0%</span >
		</div>
        <div class="files" style='margin-left:136px'></div>
        <div id="showimg"></div>
	</div>
	
	<div class="form-group" >
      <div class="col-md-2 control-label" style='margin-left:46px'>
      <label for="name">选择软件</label>
      </div>      
	    <div class="btn1"  style='margin-left:-50px'>
            <span>添加软件</span>            
            <?= Html::fileInput('filedata','', ['id'=>'fileupload1']) ?>
        </div>
        <div class="progress1" style='margin-left:250px'>
    		<span class="bar1"></span><span class="percent1">0%</span >
		</div>
        <div class="files1"></div>
        <div id="showimg1"></div>        
	</div>	
	</fieldset>	
  </div>
  </div>
   <div class="row form-group" style='margin-left:167px;'>
		 <div class="controls col-md-offset-2 col-md-8" style='margin-top:30px'>     
	  <label  class='btn btn-primary' for='' id='submi'>提交</label>		 </div>
      </div>   
